<template>
  <div class="box">
    <div class="box-title">辅助标签信息</div>
    <div
      class="box-table"
      :style="{ height: (tableData.length + 1) * 40 + 'px' }"
    >
      <hcTable
        :table-data="tableData"
        :options="tableOptions"
        :columns="tableColumn"
      >
        <template #position="{ row }">
          {{ row.position == "0" ? "正面" : "反面" }}
        </template>
        <template #proType="{ row }">
          {{ getProtype(row.proType) }}
        </template>
        <template #qaStamp="{ row }">
          {{ row.qaStamp ? "是" : "否" }}
        </template>
        <template #reelType="{ row }">
          {{ getReelType(row.reelType) }}
        </template>
        <template #mergeType="{ row }">
          {{ getMergeType(row.mergeType) }}
        </template>
        <template #forMSL1="{ row }">
          {{ row.isNotNeedLabelForMSL1 ? "是" : "否" }}
        </template>
        <template #mslPrintMethod="{ row }">
          {{ getMslPrint(row.mslPrintMethod) }}
        </template>
      </hcTable>
    </div>
  </div>
</template>
<script setup>
import { reelType } from "@/store/editStore";
defineProps({
  tableData: {
    type: Array,
    default: () => [],
  },
});

let tableOptions = {
  showPagination: false,
  border: true,
};

let tableColumn = [
  { label: "料号", prop: "code" },
  { label: "盘类型", prop: "mergeType", slot: "mergeType" },
  { label: "标签类型", prop: "proType", slot: "proType" },
  { label: "放置位置", prop: "position", slot: "position" },
  { label: "坐标X", prop: "x" },
  { label: "坐标Y", prop: "y" },
  { label: "旋转角度", prop: "angle" },
  { label: "需要印章", prop: "qaStamp", slot: "qaStamp" },
  { label: "印章料号", prop: "qaStampCode" },
  { label: "印章坐标X", prop: "qaStampX" },
  { label: "印章坐标Y", prop: "qaStampY" },
  { label: "印章角度", prop: "qaStampAngle" },
  //   { label: "粘贴湿敏标签", prop: "isNotNeedLabelForMSL1", slot: "forMSL1" },
  //   { label: "喷涂类型", prop: "mslPrintMethod", slot: "mslPrintMethod" },
  //   { label: "自定义喷涂内容", prop: "mslCustomStr" },
];

function getReelType(type) {
  let reel = ["其他", "卷盘", "包装袋", "盒子"];
  return reel[type];
}

function getProtype(type) {
  let pro = ["湿度敏感标签", "ROHS标签", "ESD静电贴"];
  return pro[type];
}

function getMslPrint() {
  let mslPrint = ["不喷码", "日期", "自定义"];
  return mslPrint[type];
}

function getMergeType(type) {
  let r = "";
  reelType.find((item) => {
    if (item.value == type) {
      r = item.label;
    }
  });
  return r;
}
</script>
<style scoped lang="scss">
.box {
  width: 100%;
  .box-title {
    height: 30px;
    line-height: 30px;
    width: 100%;
    text-align: center;
  }
  .box-table {
    display: flex;
    height: 100%;
    font-size: 14px;
  }
}
</style>
